package com.example.demo.arithmetic;

/**
 * Description: 欧几里得算法求得最大公约数<br/>
 *
 * @author liulonglong
 * @taskId <br/>
 * @Date 2020/3/13 15:26
 * @Version 1.0
 */
public class GreatestCommonFactor {
    // 假设m>=n
    public static long gcf(long m, long n) {
        while (n != 0) {
            long l = m % n;
            m = n;
            n = l;
        }
        return m;
    }

    public static void main(String[] args) {
        System.out.println(gcf(999999, 36854));
    }
}
